<?php
class Core_Data_Mailer {
	/**
	 * mail to
	 * 
	 * @var $to
	 */
	public $to         = "";
	/**
	 * subject of email
	 * @var subject
	 */
	public $subject    = "";
	/**
	 * mail message
	 * 
	 * @var message
	 */
	public $message    = "";
	/*
	 * @var fromName
	 */
	public $fromName   = "";
	/**
	 * @var fromEmail
	 */
	public $fromEmail  = "";
	/**
	 * @var replyEmail
	 */
	public $replyEmail = "";
	/**
	 * @var header
	 */
	public $header     = "";
	/**
	 * @var type
	 */
	public $type       = "text/plain";
	/**
	 * @var characterSet
	 */
	public $characterSet = "utf-8";
	
	/**
	 * constructor
	 */
	public function __construct(){
		
	}
	
	/**
	 * send e-mail
	 * 
	 * @return boolean
	 */
	public function send(){
		$this->createHeader();
		if (@mail($this->to,$this->subject,$this->message,$this->header)){
			return true;
		} else {
			return false;
		}
	}
	
	/**
	 * create e-mail header
	 * 
	 * @return header
	 */
	public function createHeader(){
		$from   = "From: $this->fromName <$this->fromEmail>\r\n";
		$replay = "Reply-To: $this->replyEmail\r\n";
		$params = "MIME-Version: 1.0\r\n";
		$params .= "Content-type: $this->type; charset=$this->characterSet\r\n";
				 
		$this->header = $from.$replay.$params;
		return $this->header;
	}
	
}